export function timeLineOption(date, data, _this, color,max) {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        animation: false,
        type: 'line',
        lineStyle: {
          color: '#00ffcc',
        }
      },
      position: function (pos, params, dom, rect, size) {
        let obj = {top: '10%'};
        if(pos[0] > (size.viewSize[0] * 0.95) - size.contentSize[0]) {
          obj['left'] = pos[0] - size.contentSize[0]
        } else {
          obj['left'] = pos[0]
        }
        return obj;
      }
    },
    grid: {
      top: '7%',
      left: '6%',
      right: '5%',
      bottom: '15%',
      containLabel: true
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: date,
      lineStyle: {
        color: '#999999'
      },
      axisLabel: {
        show: true,
        textStyle: {
          color: '#999999'
        },
      },
      axisTick: {
        show: false
      },
      axisLine: { show: false },
    },
    yAxis: {
      /*name:'',
      nameLocation: "end",//坐标位置，支持start,end，middle*/
      type: 'value',
      boundaryGap: [0, '90%'],
      splitNumber:3,
      axisTick: {show: false},
      axisLabel: {
        show: true,
        textStyle: {
          color: '#999999'
        }
      },
      splitLine: {
        lineStyle: {
          type: 'dotted',
          color: ['#666'],
          opacity: 0.6
        }
      },
      axisLine: {
        show: false,
      },
      min: 0,
      max: max
    },
    dataZoom: [{
      type: 'inside',
    }, {
      // backgroundColor: '#313946',
      handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
      handleSize: '80%',
      handleStyle: {
        color: '#243140',
        // shadowBlur: 3,
        // shadowColor: 'rgba(0, 0, 0, 0.6)',
        // shadowOffsetX: 2,
        // shadowOffsetY: 2
      },
      textStyle: {
        color: "rgba(204,187,225,0.5)",
      },
      fillerColor: "#313946",
      borderColor: "#313946",
      dataBackground: {
        areaStyle: {
          color: '#2d3641'
        },
        lineStyle: {
          opacity: 0.8,
          color: '#2d3641'
        }
      },
      bottom: '5%',
      height: '8%',
    }],
    series: [
      {
        type: 'line',
        smooth: true,
        showSymbol: false,
        itemStyle: {
          color: color[0] || '#02c51d',
        },
        areaStyle: {
          color: new _this.echarts.graphic.LinearGradient(0, 0, 0, 1, [{
            offset: 0,
            color: color[1] || 'rgba(50, 242, 77, .8)',
          }, {
            offset: 1,
            color: color[2] || 'rgba(50, 242, 77, 0)',
          }])
        },
        data: data
      }
    ]
  };
}
